<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 封装函数表达式的函数不管用户输入什么数字，求出,数组返回最大值，最小值，平均值，解构出来打印在页面中

      // console.log(arr1);
      function arr1(item) {
        document.write(`最大值${Math.max(...item)}`)
        document.write(`最小值${Math.min(...item)}`)
        let sum = 0
        for(let k in item){
          sum += item[k]
        }
        document.write(`平均值是${sum / item.length}`)
      }
      let arr = prompt(`请输入数字`)
      let arr2 = arr1(arr.split('').map((e) => e / 1))
    </script>
  </body>
</html>
